package eai.tp2.lpco.database;

import java.io.Serializable;
import java.sql.Date;
import java.util.ArrayList;
import java.util.List;

import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToMany;
import javax.persistence.OneToMany;
import javax.persistence.Table;

@Entity
@Table(name = "DIGITALCAMERA")
public class DigitalCamera implements Serializable {

	/**
	 * 
	 */
	private static final long serialVersionUID = 1L;
	/**
	 * The brand name
	 */
	private String brandName;
	/**
	 * The camera name
	 */
	private String modelName;
	/**
	 * The camera summary
	 */
	private String description;
	/**
	 * The camera announcement date
	 */
	private Date date;
	/**
	 * The camera maximum resolution
	 */
	private String maxRes;
	/**
	 * The camera minimum resolution
	 */
	private String minRes;
	/**
	 * The camera image ratio
	 */
	private String imageRatio;
	/**
	 * The camera effective pixels
	 */
	private String effectivePixels;
	/**
	 * The camera sensor size
	 */
	private String sensorSize;
	/**
	 * the camera iso rating
	 */
	private String isoRating;
	/**
	 * The camera minimum shutter
	 */
	private String minShutter;
	/**
	 * The camera maximum shutter
	 */
	private String maxShutter;
	/**
	 * The camera review link
	 */
	private String reviewLink;
	/**
	 * The camera image link
	 */
	private String imageLink;
	/**
	 * The camera id
	 */
	private Integer cameraId;
	/**
	 * The price associated
	 */
	private int price;

	public DigitalCamera() {	
		
	}

	@Column(name = "BRANDNAME")
	public String getBrandName() {
		return brandName;
	}

	public void setBrandName(String brand) {
		this.brandName = brand;
	}

	@Column(name = "MAX_RESOLUTION")
	public String getMaxRes() {
		return maxRes;
	}

	public void setMaxRes(String maxRes) {
		this.maxRes = maxRes;
	}

	@Column(name = "MIN_RESOLUTION")
	public String getMinRes() {
		return minRes;
	}

	public void setMinRes(String minRes) {
		this.minRes = minRes;
	}

	@Column(name = "IMAGE_RATIO")
	public String getImageRatio() {
		return imageRatio;
	}

	public void setImageRatio(String imageRatio) {
		this.imageRatio = imageRatio;
	}

	@Column(name = "EFFECTIVE_PIXELS")
	public String getEffectivePixels() {
		return effectivePixels;
	}

	public void setEffectivePixels(String effectivePixels) {
		this.effectivePixels = effectivePixels;
	}

	@Column(name = "SENSOR_SIZE")
	public String getSensorSize() {
		return sensorSize;
	}

	public void setSensorSize(String sensorSize) {
		this.sensorSize = sensorSize;
	}

	@Column(name = "ISO_RATING")
	public String getIsoRating() {
		return isoRating;
	}

	public void setIsoRating(String isoRating) {
		this.isoRating = isoRating;
	}

	@Column(name = "MIN_SHUTTER")
	public String getMinShutter() {
		return minShutter;
	}

	public void setMinShutter(String minShutter) {
		this.minShutter = minShutter;
	}

	@Column(name = "MAX_SHUTTER")
	public String getMaxShutter() {
		return maxShutter;
	}

	public void setMaxShutter(String maxShutter) {
		this.maxShutter = maxShutter;
	}

	@Column(name = "REVIEW_LINK")
	public String getReviewLink() {
		return reviewLink;
	}

	public void setReviewLink(String reviewLink) {
		this.reviewLink = reviewLink;
	}

	@Column(name = "IMAGE_LINK")
	public String getImageLink() {
		return imageLink;
	}

	public void setImageLink(String imageLink) {
		this.imageLink = imageLink;
	}

	@Column(name = "MODELNAME")
	public String getModelName() {
		return modelName;
	}

	public void setModelName(String name) {
		this.modelName = name;
	}

	@Column(name = "DESCRIPTION")
	public String getDescription() {
		return description;
	}

	public void setDescription(String description) {
		this.description = description;
	}

	@Column(name = "DATE")
	public Date getDate() {
		return date;
	}

	public void setDate(Date date) {
		this.date = date;
	}

	@Column(name = "CAMERAID",updatable = false)
	@Id
	public Integer getCameraId() {
		return cameraId;
	}

	public void setCameraId(Integer id) {
		this.cameraId = id;
	}
	
	public int getPrice() {
		return price;
	}

	public void setPrice(int price) {
		this.price = price;
	}

	public String toString() {
		String res = "ID: " + cameraId + "\n";
		res += "Name: " + this.modelName + "\n";
		res += "Description: " + this.description + "\n";
		if(this.date!=null)
			res += "Date: " + this.date.toString() + "\n";
		res += "Max Resolution: " + this.maxRes + "\n";
		res += "Min Resolution: " + this.minRes + "\n";
		res += "Image Ratio: " + this.imageRatio + "\n";
		res += "Effective Pixels: " + this.effectivePixels + "\n";
		res += "Sensor Size: " + this.sensorSize + "\n";
		res += "Iso Rating: " + this.isoRating + "\n";
		res += "Max Shutter: " + this.maxShutter + "\n";
		res += "Min Shutter: " + this.minShutter + "\n";
		res += "Review Link: " + this.reviewLink + "\n";
		res += "Picture Link: " + this.imageLink + "\n";

		return res;
	}
	

}
